home *** CD-ROM | disk | FTP | other *** search
/ The 640 MEG Shareware Studio 2 / The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO / pascal / tpb4_src.zip / CORE1.PAS < prev    next >
Pascal/Delphi Source File  |  1988-09-13  |  21KB  |  970 lines

  1. { TPBoard 4.2 Copyright (c) 1987,88 by Jon Schneider & Rick Petersen  
  2.   Portions Copyright (c) 1986,87 by Steve Fox and Les Archambault  
  3.   
  4.   Last modified  ::  9-13-88 7:03 pm 
  5. }
  6.  
  7. {$R-}                             {Range checking off}
  8. {$B-}                             {Boolean complete evaluation off}
  9. {$S-}                             {Stack checking off}
  10. {$I+}                             {I/O checking on}
  11. {$N-}                             {No numeric coprocessor}
  12.  
  13. Unit Core1;
  14.  
  15. Interface
  16.  
  17. Uses
  18.   TPCrt, Dos, Globals, KeyStuff;
  19.   
  20.   
  21. procedure AssignAux(var F : Text);
  22.  
  23. procedure System_Init;
  24.  
  25. procedure putstat(st, st1 : StrStd);
  26.  
  27. function Ch_Carck : Boolean;
  28.  
  29. procedure Ch_Set(R : Word);
  30.  
  31. procedure Ch_Init;
  32.  
  33. procedure System_De_Init;
  34.  
  35. function Ch_Inprdy : Boolean;
  36.  
  37. procedure Ch_Out(Data : Byte);
  38.  
  39. procedure Ch_Wait;
  40.  
  41. procedure Clear_inbuf;
  42.  
  43. procedure GetTAD(var t : tad_array);
  44.  
  45. procedure mdhangup;
  46.  
  47. procedure mdbusy;
  48.  
  49. function mdring : Boolean;
  50.  
  51. procedure mdans;
  52.  
  53. procedure mdinit;
  54.  
  55. procedure FlushAny(var F);
  56.  
  57. procedure log(activity : Byte; Text : DosFileName);
  58.  
  59. procedure SetSect(Dirspec : StrPr);
  60.  
  61. function input_timeout : Boolean;
  62.  
  63. function Online : Boolean;
  64.  
  65. procedure PutByte(b : Byte);
  66.  
  67. function GetByte(sec : Integer; var timeout : Boolean) : Byte;
  68.  
  69. function GetChar : Char;
  70.  
  71. function brk    : Boolean;
  72.  
  73.  
  74.   {==========================================================================}
  75.   
  76.   
  77. Implementation
  78.  
  79.  
  80.   {$F+}
  81.   function AuxOutput(var F : TextRec) : Integer;
  82.     { User written I/O driver to output character }
  83.     
  84.   var
  85.     i, Row, Col     : Integer;
  86.     Regs            : Dos.Registers;
  87.     ch              : Char;
  88.     
  89.   begin
  90.     ch := F.BufPtr^[0];
  91.     if user_rec.shift_lock then
  92.       ch := Upcase(ch);
  93.     if printer_copy then
  94.       begin
  95.         Regs.AH := 5;
  96.         Regs.DL := Ord(ch);
  97.         MsDos(Regs);
  98.       end;
  99.     if (Online) then
  100.       begin
  101.         if (ch <> BEL) or local_online then
  102.           begin
  103.             Row := WhereY;
  104.             Col := WhereX;
  105.             if ((ch = LF) or (Col >= 79)) and (Row = 23) then
  106.               begin
  107.                 Regs.AH := 6;
  108.                 Regs.AL := 1;
  109.                 Regs.BH := 15;
  110.                 Regs.ch := 0;
  111.                 Regs.CL := 0;
  112.                 Regs.DH := 22;
  113.                 Regs.DL := 79;
  114.                 Intr($10, Regs);
  115.                 Dec(Row);
  116.                 GoToXY(Col, Row);
  117.               end;
  118.             Regs.AH := 6;
  119.             Regs.DL := Ord(ch);
  120.             MsDos(Regs);
  121.           end;
  122.         if remote_copy and (not local_online) then
  123.           begin
  124.             Ch_Out(Ord(ch));
  125.             if ch = CR then
  126.               for i := 1 to user_rec.nulls do
  127.                 Ch_Out(Ord(NUL));
  128.             if ch = LF then
  129.               for i := 1 to (user_rec.nulls shr 2) do
  130.                 Ch_Out(Ord(NUL))
  131.           end;
  132.       end;
  133.     F.BufPos := 0;
  134.     AuxOutput := 0;
  135.   end;
  136.   
  137.   
  138.   
  139.   function AuxIgnore(var F : TextRec) : Integer;
  140.   
  141.   begin
  142.     AuxIgnore := 0
  143.   end;
  144.   
  145.   
  146.   
  147.   function AuxOpen(var F : TextRec) : Integer;
  148.   
  149.   begin
  150.     with F do
  151.       begin
  152.         if mode = fmOutput then
  153.           begin
  154.             InOutFunc := @AuxOutput;
  155.             FlushFunc := @AuxIgnore
  156.           end
  157.         else
  158.           begin
  159.             InOutFunc := @AuxIgnore;
  160.             FlushFunc := @AuxIgnore
  161.           end;
  162.         CloseFunc := @AuxIgnore;
  163.       end;
  164.     AuxOpen := 0;
  165.   end;
  166.   
  167.   
  168.   {$F-}
  169.   procedure AssignAux;
  170.   
  171.   begin                           {AssignAux}
  172.     with TextRec(F) do
  173.       begin
  174.         Handle := $FFFF;
  175.         mode := fmClosed;
  176.         BufSize := 1;
  177.         BufPtr := @Buffer;
  178.         OpenFunc := @AuxOpen;
  179.         name[0] := #0;
  180.       end;
  181.   end;                            {AssignAux}
  182.   
  183.   
  184.   procedure System_Init;          {called once when TPBoard first Starts}
  185.   
  186.   var OrigMode    : Integer;
  187.   
  188.   begin
  189.     CheckBreak := False;
  190.     OrigMode := LastMode;
  191.     TextMode(OrigMode);
  192.     DetectMultiTasking := True;
  193.     ReinitCrt;
  194.     TextColor(TPCrt.White);
  195.   end;
  196.   
  197.   
  198.   
  199.   procedure putstat(st, st1 : StrStd);
  200.     { Display 'st' on status line }
  201.     
  202.     
  203.   var
  204.     Row, Col        : Integer;
  205.     
  206.   begin
  207.     Col := WhereX;
  208.     Row := WhereY;
  209.     if Row > 23 then
  210.       Row := 23;
  211.     GoToXY(1, 24);
  212.     ClrEol;
  213.     HighVideo;
  214.     Write(st);
  215.     GoToXY(1, 25);
  216.     ClrEol;
  217.     Write(st1);
  218.     LowVideo;
  219.     GoToXY(Col, Row);
  220.   end;
  221.   
  222.   
  223.   { Communications Routines}
  224.   
  225.   
  226.   procedure Ch_On;                {Turn on the remote channel}
  227.   
  228.   var
  229.     Regs            : Dos.Registers;
  230.     
  231.   begin
  232.     with Regs do
  233.       begin
  234.         AH := 6;
  235.         AL := 1;
  236.         DX := Pred(com_port);
  237.         Intr($14, Regs);
  238.       end;
  239.   end;
  240.   
  241.   
  242.   
  243.   procedure Ch_Off;               {Turn off the remote chanel}
  244.   
  245.   var
  246.     Regs            : Dos.Registers;
  247.     
  248.   begin
  249.     with Regs do
  250.       begin
  251.         AH := 6;
  252.         AL := 0;
  253.         DX := Pred(com_port);
  254.         Intr($14, Regs);
  255.       end;
  256.   end;
  257.   
  258.   
  259.   function Ch_Carck : Boolean;    {check for carrier present}
  260.   
  261.   var
  262.     Regs            : Dos.Registers;
  263.     
  264.   begin
  265.     with Regs do
  266.       begin
  267.         AH := 3;
  268.         DX := Pred(com_port);
  269.         Intr($14, Regs);
  270.         Ch_Carck := ((AL and $80) <> 0)
  271.       end;
  272.   end;
  273.   
  274.   
  275.   procedure Ch_Set(R : Word);     {set baud rate}
  276.   
  277.   var
  278.     Regs            : Dos.Registers;
  279.     
  280.   begin
  281.     rate := R;
  282.     with Regs do
  283.       begin
  284.         case R of
  285.           300 :
  286.             AL := $40;
  287.           1200 :
  288.             AL := $80;
  289.           2400 :
  290.             AL := $A0;
  291.           9600 :
  292.             AL := $E0;
  293.           19200 :
  294.             AL := $00;
  295.         end;
  296.         AL := (AL or 3);
  297.         AH := 0;
  298.         DX := Pred(com_port);
  299.         Intr($14, Regs);
  300.       end;
  301.   end;
  302.   
  303.   
  304.   { This procedure MUST be called before doing any I/O. }
  305.   
  306.   procedure Ch_Init;
  307.   
  308.   var
  309.     Regs            : Dos.Registers;
  310.     
  311.   begin
  312.     with Regs do
  313.       begin
  314.         AH := 4;
  315.         DX := Pred(com_port);
  316.         Intr($14, Regs);
  317.         if AX <> $1954 then
  318.           begin
  319.             WriteLn('No Fossil Driver detected, aborting...');
  320.             Halt
  321.           end;
  322.       end;
  323.   end;
  324.   
  325.   
  326.   { This procedure shuts-down communications }
  327.   
  328.   procedure System_De_Init;
  329.   
  330.   var
  331.     Regs            : Dos.Registers;
  332.     
  333.   begin
  334.     with Regs do
  335.       begin
  336.         AH := 5;
  337.         DX := Pred(com_port);
  338.         Intr($14, Regs);
  339.       end;
  340.   end;
  341.   
  342.   
  343.   { This procedure tells you if there's any input }
  344.   
  345.   function Ch_Inprdy : Boolean;
  346.   
  347.   var
  348.     Regs            : Dos.Registers;
  349.     
  350.   begin
  351.     with Regs do
  352.       begin
  353.         AH := 3;
  354.         DX := Pred(com_port);
  355.         Intr($14, Regs);
  356.         Ch_Inprdy := ((AH and 1) <> 0)
  357.       end;
  358.   end;
  359.   
  360.   
  361.   { This procedure reads input from the ring buffer - no wait, assumes ready }
  362.   
  363.   function Ch_Inp : Byte;
  364.   
  365.   var
  366.     Regs            : Dos.Registers;
  367.     
  368.   begin
  369.     with Regs do
  370.       begin
  371.         AH := 2;
  372.         DX := Pred(com_port);
  373.         Intr($14, Regs);
  374.         Ch_Inp := AL
  375.       end;
  376.   end;
  377.   
  378.   
  379.   { This procedure writes output, filling the ring buffer if necessary.}
  380.   
  381.   procedure Ch_Out(Data : Byte);
  382.   
  383.   var
  384.     Regs            : Dos.Registers;
  385.     
  386.   begin
  387.     with Regs do
  388.       begin
  389.         AH := 1;
  390.         DX := Pred(com_port);
  391.         AL := Data;
  392.         Intr($14, Regs);
  393.       end;
  394.   end;
  395.   
  396.   
  397.   { This procedure waits till the transmit buffer is empty.}
  398.   
  399.   procedure Ch_Wait;
  400.   
  401.   var
  402.     Regs            : Dos.Registers;
  403.     
  404.   begin
  405.     with Regs do
  406.       begin
  407.         repeat
  408.           AH := 3;
  409.           DX := Pred(com_port);
  410.           Intr($14, Regs);
  411.         until (AH and $40) <> 0
  412.       end;
  413.   end;
  414.   
  415.   
  416.   procedure Clear_inbuf;
  417.   
  418.   var
  419.     Regs            : Dos.Registers;
  420.     
  421.   begin
  422.     with Regs do
  423.       begin
  424.         AH := 10;
  425.         DX := Pred(com_port);
  426.         Intr($14, Regs);
  427.       end;
  428.   end;
  429.   
  430.   
  431.   { Clock routines}
  432.   
  433.   procedure GetTAD(var t : tad_array);
  434.    { Return a 6 element integer array of the current system time in
  435.      seconds, minutes, hours, day, month, and year. }
  436.      
  437.   var
  438.     temp1, temp2, temp3, temp4 : Word;
  439.     
  440.   begin
  441.   
  442.     GetTime(temp1, temp2, temp3, temp4);
  443.     t[0] := temp3;                { secs }
  444.     t[1] := temp2;                { mins }
  445.     t[2] := temp1;                { hrs  }
  446.     
  447.     GetDate(temp1, temp2, temp3, temp4);
  448.     t[3] := temp3;                { day }
  449.     t[4] := temp2;                { mon }
  450.     t[5] := temp1-1900;           { yr  }
  451.     
  452.   end;
  453.   
  454.   
  455.   
  456.   { Modem routines}
  457.   
  458.   function mdresult(secs : Integer) : Str3;
  459.     {get result code from mdodem with timeout}
  460.     
  461.   var
  462.     count           : Real;
  463.     ch              : Char;
  464.     result          : Str3;
  465.     
  466.   begin
  467.     result := '';
  468.     count := secs/0.001;
  469.     repeat
  470.       repeat
  471.         count := count-1.0;
  472.         Delay(1);
  473.       until (Ch_Inprdy) or (count <= 0);
  474.       if count > 0 then
  475.         begin
  476.           ch := Chr(Ch_Inp);
  477.           if ch in ['0'..'9'] then
  478.             result := result+ch;
  479.           if Length(result) > 2 then
  480.             Delete(result, 1, 1);
  481.         end;
  482.     until ((ch = CR) and (Length(result) > 0)) or (count <= 0);
  483.     if count > 0 then
  484.       mdresult := result
  485.     else
  486.       mdresult := '';
  487.   end;
  488.   
  489.   
  490.   
  491.   procedure mdsend(st : StrStd);
  492.     { Send a command string to the modem  }
  493.     
  494.   var
  495.     i, n            : Byte;
  496.     
  497.   begin
  498.     while Ch_Inprdy do
  499.       i := Ch_Inp;                {clear buffer}
  500.     for i := 1 to Length(st) do
  501.       begin
  502.         if st[i] = '~' then
  503.           Delay(1000)
  504.         else if st[i] = '|' then
  505.           Ch_Out(Ord(CR))
  506.         else
  507.           Ch_Out(Ord(st[i]));
  508.         Delay(100);
  509.         if (Ch_Inprdy) then
  510.           n := Ch_Inp;            {eat echo, if any}
  511.       end;
  512.   end;
  513.   
  514.   
  515.   
  516.   procedure mdhangup;
  517.     { Hangup modem }
  518.     
  519.   var
  520.     i               : Integer;
  521.     bt              : Byte;
  522.     
  523.   begin
  524.     repeat
  525.       Ch_Off;
  526.       Delay(2000);
  527.       Ch_On;
  528.       if Ch_Carck then
  529.         begin
  530.           for i := 1 to 3 do
  531.             Ch_Out(Ord(Attention));
  532.           Delay(2000);
  533.           mdsend(hang_up_str);
  534.         end;
  535.     until not Ch_Carck;
  536.     while Ch_Inprdy do
  537.       bt := Ch_Inp;               {clear buffer}
  538.     Ch_Set(modem_rate)
  539.   end;
  540.   
  541.   
  542.   
  543.   procedure mdbusy;
  544.     { Take modem off hook to present a busy signal to incoming callers }
  545.     
  546.   begin
  547.     mdsend(off_hook_str);         { Take modem off hook }
  548.   end;
  549.   
  550.   
  551.   
  552.   function mdring : Boolean;
  553.     { Determine if the phone is ringing }
  554.     
  555.   var
  556.     ans             : Char;
  557.     
  558.   begin
  559.     ans := ' ';                   {initialize}
  560.     if Ch_Inprdy then
  561.       ans := Chr(Ch_Inp);
  562.     if ans = RING then
  563.       begin
  564.         ans := Chr(Ch_Inp);       {get CR from modem}
  565.         mdring := True;
  566.       end
  567.     else
  568.       mdring := False;
  569.   end;
  570.   
  571.   
  572.   
  573.   procedure mdans;
  574.     { Detect and set system to rate at which modem answered phone }
  575.     
  576.   var
  577.     result          : Str3;
  578.     
  579.   begin
  580.     mnp := False;
  581.     Delay(answer_delay);
  582.     if (not modem_answer) then
  583.       begin
  584.         mdsend(answer_str);       { Let the modem answer }
  585.         Delay(answer_delay);
  586.         result := mdresult(15);   { first check for OK response }
  587.         if (result = OKAY) or (result = '') then
  588.           result := mdresult(40); { get actual speed code response}
  589.       end
  590.     else
  591.       result := mdresult(40);
  592.     if result = connect300 then
  593.       Ch_Set(300)
  594.     else if result = connect1200 then
  595.       Ch_Set(1200)
  596.     else if result = connect2400 then
  597.       Ch_Set(2400)
  598.     else if result = connect9600 then
  599.       Ch_Set(9600)
  600.     else if result = connect1200ecc then
  601.       begin
  602.         Ch_Set(1200);
  603.         mnp := True;
  604.       end
  605.     else if result = connect2400ecc then
  606.       begin
  607.         Ch_Set(2400);
  608.         mnp := True;
  609.       end
  610.     else if result = connect9600ecc then
  611.       begin
  612.         Ch_Set(9600);
  613.         mnp := True;
  614.       end
  615.     else
  616.       mdhangup;
  617.     Delay(500);                   { Make sure carrier is stable }
  618.     Clear_inbuf;
  619.   end;
  620.   
  621.   
  622.   
  623.   procedure mdinit;
  624.     { Ensure the modem is hung up, initialized, and ready to wait for a ring. }
  625.     
  626.   var
  627.     bt              : Byte;
  628.     
  629.   begin
  630.     bt := 0;
  631.     System_De_Init;               {clear communications chanel}
  632.     Delay(500);
  633.     Ch_Init;                      { re-initialize it}
  634.     Ch_Set(modem_rate);           { set baud }
  635.     Ch_Out(Ord(CR));              { get modem's attention}
  636.     repeat
  637.       Delay(1000);
  638.       Inc(bt);
  639.       Clear_inbuf;                {clear buffer}
  640.       mdsend(init_str);
  641.     until (mdresult(5) = OKAY) or (bt > 4);
  642.     if bt > 4 then
  643.       begin
  644.         putstat('Modem Initialization Problem...', ' ');
  645.         Delay(7500);
  646.       end;
  647.   end;
  648.   
  649.   
  650.   procedure FlushAny(var F);
  651.   
  652.   var
  653.     Handle          : Integer absolute F; {File handle is the first word of a file's FIB}
  654.     Regs            : Dos.Registers;
  655.     
  656.   begin
  657.     Regs.AH := $45;               {DOS function to duplicate a file handle}
  658.     Regs.BX := Handle;
  659.     MsDos(Regs);
  660.     if Odd(Regs.flags) then       {Check if carry flag is set}
  661.       begin
  662.         WriteLn('Unable to duplicate file handle');
  663.         Halt
  664.       end;
  665.     Regs.BX := Regs.AX;           {Put new file handle into BX}
  666.     Regs.AH := $3E;               {Dos function to close a file handle}
  667.     MsDos(Regs);
  668.     if Odd(Regs.flags) then       {Check if carry flag is set}
  669.       begin
  670.         WriteLn('Unable to close duplicated handle');
  671.         Halt
  672.       end
  673.   end {FlushAny} ;
  674.   
  675.   
  676.   
  677.   procedure log(activity : Byte; Text : DosFileName);
  678.   
  679.   var
  680.     t               : tad_array;
  681.     
  682.   begin
  683.     Seek(logr_file, FileSize(logr_file));
  684.     GetTAD(t);
  685.     if ((login_t[2] > 21) and (t[2] < 2) and (login_t[3] = t[3])) then
  686.       Mem[$40:$70] := 1;
  687.     GetTAD(logr_rec.date);
  688.     logr_rec.action := activity;
  689.     if valid_pw then
  690.       logr_rec.user := user_loc
  691.     else
  692.       logr_rec.user := 0;
  693.     logr_rec.Text := Text;
  694.     Write(logr_file, logr_rec);
  695.     FlushAny(logr_file);
  696.   end;
  697.   
  698.   
  699.   
  700.   procedure SetSect(Dirspec : StrPr);
  701.     { Set to file section }
  702.     
  703.   var
  704.     OK              : Boolean;
  705.     i               : Integer;
  706.     
  707.   begin
  708.     {$I-}
  709.     ChDir(Dirspec); {$I+}
  710.     OK := (IoResult = 0);
  711.     if (not OK) then
  712.       begin
  713.         {$I-}
  714.         MkDir(Dirspec);
  715.         ChDir(Dirspec); {$I+}
  716.         i := IoResult
  717.       end;
  718.   end;
  719.   
  720.   
  721.   
  722.   function input_timeout : Boolean;
  723.     {decrement counter to determine timeout}
  724.     
  725.   var
  726.     Regs            : Dos.Registers;
  727.     test            : Word;
  728.     
  729.   begin
  730.     Regs.AH := 0;
  731.     Intr($1A, Regs);
  732.     if Regs.AL <> 0 then
  733.       Mem[$40:$70] := 1;
  734.     test := Regs.DX;
  735.     if test <> time_count then
  736.       begin
  737.         time_count := test;
  738.         if (not local_online) then
  739.           input_time := input_time-1.0;
  740.         if local_online then
  741.           input_time := input_time-0.2;
  742.       end;
  743.     if input_time < 0.0 then
  744.       begin
  745.         WriteLn(com, ' +++ Input timed out +++');
  746.         SetSect(HomName);
  747.         log(13, ' ');
  748.         remote_online := False;
  749.         if local_online then
  750.           local_online := False;  {sysop timeout}
  751.         mdhangup;
  752.         input_timeout := True;
  753.       end
  754.     else
  755.       input_timeout := False;
  756.   end;
  757.   
  758.   
  759.   
  760.   function Online : Boolean;
  761.     { Determine whether system is still online - local or remote }
  762.     
  763.   begin
  764.     if remote_online then
  765.       if Ch_Carck then
  766.         Online := True
  767.       else
  768.         begin
  769.           putstat('Carrier lost', ' ');
  770.           SetSect(HomName);
  771.           log(12, ' ');
  772.           mdhangup;
  773.           remote_online := False;
  774.           Online := False;
  775.         end
  776.     else
  777.       Online := local_online
  778.   end;
  779.   
  780.   
  781.   
  782.   procedure PutByte(b : Byte);
  783.   
  784.   begin
  785.     if Ch_Carck then
  786.       Ch_Out(b)
  787.   end;
  788.   
  789.   
  790.   
  791.   function GetByte(sec : Integer; var timeout : Boolean) : Byte;
  792.     { Get byte from modem with 'sec' seconds timeout }
  793.     
  794.   var
  795.     test            : Word;
  796.     count           : Real;
  797.     Regs            : Dos.Registers;
  798.     
  799.   begin
  800.     time_count := 0;
  801.     count := sec*18.2;
  802.     while (not Ch_Inprdy) and (Ch_Carck) and (count > 0.0) do
  803.       begin
  804.         Regs.AH := 0;
  805.         Intr($1A, Regs);
  806.         if Regs.AL <> 0 then
  807.           Mem[$40:$70] := 1;
  808.         test := Regs.DX;
  809.         if test <> time_count then
  810.           begin
  811.             time_count := test;
  812.             count := count-1.0;
  813.           end;
  814.       end;
  815.     timeout := (not Ch_Carck) or (count <= 0.0);
  816.     if timeout then
  817.       GetByte := Ord(NUL)
  818.     else
  819.       GetByte := Ch_Inp;
  820.   end;
  821.   
  822.   
  823.   
  824.   function GetChar : Char;
  825.     { Get character: no wait, no echo }
  826.     
  827.   var
  828.     ch, command     : Char;
  829.     key_char        : string[1];
  830.     
  831.   begin
  832.     if Queue <> '' then
  833.       begin
  834.         key_char := Queue[1];
  835.         Delete(Queue, 1, 1);
  836.         key_char := StuffKey(key_char);
  837.       end;
  838.     if KeyPressed then
  839.       begin
  840.         ch := ReadKey;
  841.         if ch = NUL then
  842.           begin
  843.             ch := ReadKey;
  844.             case ch of
  845.               #35 :               { Alt H }
  846.                 ch := LF;
  847.               #59 :               { F1 }
  848.                 ch := ^W;
  849.               #60 :               { F2 }
  850.                 ch := ^E;
  851.               #61 :               { F3 }
  852.                 ch := ^R;
  853.               #62 :               { F4 }
  854.                 begin
  855.                   if in_chat and remote_online then
  856.                     begin
  857.                       case mode of
  858.                         message_mode :
  859.                           command := 'M';
  860.                         files_mode :
  861.                           command := 'F';
  862.                       else
  863.                         command := 'U';
  864.                       end;
  865.                       Queue := ^E+^C+'X V Y '+command+CR+^E+^W+CR+
  866.                       'You are now validated.'+CR;
  867.                     end;
  868.                   ch := NUL;
  869.                 end;
  870.               #68 :               { F10 }
  871.                 ch := ^t;
  872.             else
  873.               ch := NUL;
  874.             end
  875.           end;
  876.         chl := ch;
  877.         if (not Online) and (not(ch in [^C, LF, CR, FF])) then
  878.           ch := NUL;
  879.         case ch of
  880.           ^W :
  881.             begin
  882.               op_chat := True;
  883.               ch := CR
  884.             end;
  885.           ^E :
  886.             begin
  887.               remote_copy := not remote_copy;
  888.               if remote_copy then
  889.                 begin
  890.                   putstat('Remote copy on', ' ');
  891.                   new_dir := True
  892.                 end
  893.               else
  894.                 putstat('Remote copy off', ' ');
  895.               ch := NUL
  896.             end;
  897.           ^R :
  898.             begin
  899.               delay_down := not delay_down;
  900.               if delay_down then
  901.                 putstat('Delayed shutdown on', ' ')
  902.               else
  903.                 putstat('Delayed shutdown off', ' ');
  904.               ch := NUL
  905.             end;
  906.           ^t :
  907.             begin
  908.               remote_online := False;
  909.               mdhangup;
  910.               ch := NUL
  911.             end;
  912.           LF :
  913.             begin
  914.               if Online then
  915.                 putstat(
  916.                   '^W or F1: CHAT             ^E or F2:  Toggle Remote Copy       ^T or F10: Twit',
  917.                   '^R or F3: Delayed Shutdown       F4:  Validate User from CHAT')
  918.               else
  919.                 putstat('^C: Shutdown TPBoard, ^L: Local use', ' ');
  920.               if Online then
  921.                 ch := NUL;
  922.             end
  923.         end
  924.       end
  925.     else if remote_online and remote_copy and Ch_Carck and Ch_Inprdy then
  926.       ch := Chr($7F and Ch_Inp)
  927.     else
  928.       ch := NUL;
  929.     GetChar := ch
  930.   end;
  931.   
  932.   
  933.   
  934.   function brk    : Boolean;
  935.     { Check for break or pause }
  936.     
  937.   var
  938.     test            : Boolean;
  939.     ch              : Char;
  940.     
  941.   begin
  942.     if (not abort) then
  943.       begin
  944.         input_time := timeout*18.2;
  945.         time_count := 0;
  946.         ch := GetChar;
  947.         if ch = DC3 then          { ^S }
  948.           repeat
  949.             ch := GetChar
  950.           until (not Online) or (ch <> NUL) or (input_timeout);
  951.         test := (not Online) or (ch = ETX) or (ch = #$0B) or (Upcase(ch) = 'K')
  952.         or (ch = ESC);
  953.         if test then
  954.           begin
  955.             mult_cmds := False;
  956.             Cmd_Queue := '';
  957.           end;
  958.         brk := test;
  959.       end
  960.     else
  961.       begin
  962.         abort := False;
  963.         brk := True;
  964.       end;
  965.   end;
  966.   
  967.   
  968. end.                              { of CORE1.PAS }
  969. 
  970.